package com.azirkxs.clothes.cys.service.impl;

import com.azirkxs.clothes.cys.entity.UserTags;
import com.azirkxs.clothes.cys.mapper.UserTagsMapper;
import com.azirkxs.clothes.cys.service.IUserTagsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author azirkxs
 * @since 2023-04-10
 */
@Service
public class UserTagsServiceImpl extends ServiceImpl<UserTagsMapper, UserTags> implements IUserTagsService {

    @Override
    public int updateUserTags(Integer userId, List<Integer> tagIds) {
        Map<String, Object> paramMap = new HashMap<>();

        this.baseMapper.deleteUserTags(userId);
        paramMap.put("userId", userId);
        paramMap.put("tags", tagIds);
        this.baseMapper.insertUserTags(paramMap);

        return 0;
    }
}
